#pragma once

#include <SFML/Graphics.hpp>
#include "Player.h"
#include "BulletHandler.h"
#include "Light_Point.h"
#include "LightSystem.h"
#include "Utils.h"
#include <vector>
#include <SFML\Audio.hpp>
#include "minigun.h"
#include "HUD.h"


class Input
{
public:
	Input();
	~Input();

	void initialize(sf::RenderWindow* window, Player* player, BulletHandler* bulletHandler);
	void update(sf::Vector2i mousePos, sf::Vector2f playerPos, sf::Vector2f viewCenter, ltbl::Light_Point* muzzleFlash, HUD* HUDObj);
	void cleanup();
	bool pistolPickedUp;
	bool shotgunPickedUp;
	bool machinegunPickedUp;
	int gun_total_ammo;

	int gun_clip_ammo;
	int shotgun_total_ammo;
	int shotgun_clip_ammo;
	int machinegun_total_ammo;
	int machinegun_clip_ammo;
	int random_minigun_number;

	sf::Clock* m_flashClock;
	sf::Clock* m_clock;


	minigun* minigunObj;
	bool MG_exists;

	bool isFainted;

	bool canMoveLeft;
	bool canMoveRight;
	bool canMoveUp;
	bool canMoveDown;
		
	Player* m_player;
		
	sf::Clock* minigunClock;

	bool MG_is_usable;

	sf::Texture* MG_Frame_Tex;
	sf::Sprite* MG_Frame_Sprite;
	sf::Vector2f MG_pos;

	sf::Texture* MG_BG_Tex;
	sf::Sprite* MG_BG_Sprite;
	sf::Vector2f MG_BG_pos;
	sf::Sound reload_gun;
	sf::Sound reload_shotgun;
	sf::Sound reload_machinegun;
	sf::Sound gunshot;
	sf::Sound walk;
	sf::Sound shotgunFire;
	sf::Sound minigun_sound;


private:
	sf::RenderWindow* m_renderWindow;	
	BulletHandler* m_bulletHandler;
	sf::Vector2i m_mousePos;
	sf::Vector2f m_playerPos;
	sf::Time m_timer;
	sf::Clock* reload_clock;
	sf::Time reload_timer;
	float m_pistolRate;
	float m_machinegunRate;
	float m_shotgunRate;
	float m_knifeRate;
	float angle;
	float machinegunAngle;
	float randomAngle;
	bool flashExists;
	
	
	bool equipKnife;

	sf::SoundBuffer reload_gun_buffer;

	sf::SoundBuffer reload_shotgun_buffer;

	sf::SoundBuffer reload_machinegun_buffer;
	
	sf::SoundBuffer gunshot_buffer;

	sf::SoundBuffer player_walk_0;
	sf::SoundBuffer player_walk_1;
	sf::SoundBuffer player_walk_2;
	sf::SoundBuffer player_walk_3;
	sf::SoundBuffer player_walk_4;
	sf::SoundBuffer player_walk_5;
	sf::SoundBuffer player_walk_6;
	
	sf::Sound machinegunFire;

	sf::SoundBuffer shotgunFireBuffer;
	sf::SoundBuffer machinegunFireBuffer;

	sf::SoundBuffer minigun_sound_buffer_1;
	sf::SoundBuffer minigun_sound_buffer_2;
	sf::SoundBuffer minigun_sound_buffer_3;
	sf::SoundBuffer minigun_sound_buffer_4;
	sf::SoundBuffer minigun_sound_buffer_5;
	sf::SoundBuffer minigun_sound_buffer_6;
	sf::SoundBuffer minigun_sound_buffer_7;
	sf::SoundBuffer minigun_sound_buffer_8;

	sf::Texture* coolDownTex;
	sf::Texture* coolDownFullTex;
	sf::Sprite* coolDownSprite;
	sf::Sprite* coolDownFullSprite;
	
	

	sf::Clock* deltaClock;
	sf::Time deltaTime;

	float minigunCooldown;


};

